﻿@model DTcms.Model.oauth_app
@{
    ViewBag.Title = "编辑OAuth应用";
}
<form id="form1" class="layui-form" url="OauthAppSave?action=@ViewBag.action&id=@ViewBag.id">
    @Html.AntiForgeryToken()
    <!--导航栏-->
    <div class="pageheader">
        <div class="page-bar">
            <ul class="page-breadcrumb">
                <li><a href="../users/oauth_app_list" class="back"><i class="fa fa-mail-reply-all"></i> 返回列表页</a></li>
                <li><a href="javascript:;"><i class="iconfont icon-home1"></i> 首页</a> </li>
                <li><a href="javascript:;">会员设置</a> </li>
                <li><a href="javascript:;">编辑OAuth应用</a> </li>
            </ul>
        </div>
    </div>
    <!--/导航栏-->
    <!--内容-->
    <div class="layui-fluid">
        <div class="layui-tab layui-tab-card">
            <ul class="layui-tab-title" id="floatHead">
                <li class="layui-this">编辑OAuth应用</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label">应用标题</label>
                        <div class="layui-input-block">
                            @Html.TextBox("title", Model.title, new { @class = "input normal", datatype = "*2-100", sucmsg = " " })
                            <span class="Validform_checktip">*标题名称，100字符内</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否启用</label>
                        <div class="layui-input-block">
                            @Html.CheckBox("is_lock", Model.is_lock == 0, new { title = "是" })
                            <span class="Validform_checktip">*不启用则不显示该应用</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">排序数字</label>
                        <div class="layui-input-block">
                            @Html.TextBox("sort_id", Model.sort_id, new { @class = "input small", datatype = "n", sucmsg = " " })
                            <span class="Validform_checktip">*数字，越小越向前</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">API目录</label>
                        <div class="layui-input-block">
                            @Html.TextBox("api_path", Model.api_path, new { @class = "input txt", datatype = "*", sucmsg = " " })
                            <span class="Validform_checktip">*API目录必须存在，存放站点api/oauth目录下</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">显示图标</label>
                        <div class="layui-input-block">
                            @Html.TextBox("img_url", Model.img_url, new { @class = "input normal upload-path" })
                            <div class="upload-box choose-pick"><a href="javascript:;" class="webuploader-pick" title="图片空间">选择图片</a></div>
                            <div class="upload-box upload-img"></div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">描述说明</label>
                        <div class="layui-input-block">
                            @Html.TextArea("remark", Model.remark, new { @class = "input normal" })
                            <span class="Validform_checktip">支持HTML代码</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--/内容-->
    <!--工具栏-->
    <div class="page-footer">
        <div class="btn-wrap">
            <button class="layui-btn icon-btn" id="btnSubmit"><i class="layui-icon layui-icon-ok"></i>提交保存</button>
            <button class="layui-btn layui-btn-warm icon-btn" name="btnReturn" onclick="javascript:history.back(-1);"><i class="layui-icon layui-icon-return"></i>返回上一页</button>
        </div>
    </div>
    <!--/工具栏-->
</form>
@section Scripts{
    <script type="text/javascript" src="/scripts/libs/js/uploader.js"></script>
    <script type="text/javascript">
        layui.use(['jqueryform', 'validform', 'element', 'fileChoose'], function () {
            var fileChoose = layui.fileChoose;
            $('.choose-pick').click(function () {
                var obj = $(this);
                fileChoose.open({
                    fileUrl: '',
                    listUrl: '/admin_ajax/files',
                    num: 1,
                    dialog: {
                        offset: '60px'
                    },
                    onChoose: function (res) {
                        if (res[0].type != "file") {
                            layer.msg('我只让你选择图片格式的文件', { icon: 2, time: 2000 }, function () { });
                            return;
                        }
                        obj.siblings(".upload-path").val(res[0].url);
                        obj.siblings(".layer-photos").show().find("img").attr("src", res[0].url);
                    }
                });
            });
            //初始化表单验证
            $("#form1").initValidform('#btnSubmit', 1);

            //初始化上传控件
            $(".upload-img").InitUploader({ sendurl: "/upload_ajax/action", swf: "/scripts/libs/module/uploader/uploader.swf" });
        });
    </script>
}